package com.itc.dispatch.controller;

import com.itc.common.core.constant.SecurityConstants;
import com.itc.common.security.annotation.InnerAuth;
import com.itc.dispatch.service.*;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author zhangyh
 */
@Api(tags = "调度服务Feign远程调用客户端")
@RestController
@RequestMapping("/dispatchFeign")
public class DispatchClient {
    @Autowired
    private FlightOperationMonitoringService monitoringService;

    @Autowired
    private AlarmConfigService alarmConfigService;

    @Autowired
    private FlightTimeExchangeService flightTimeExchangeService;

    @Autowired
    private FlightOperationMonitoringPtdService flightOperationMonitoringPtdService;

    @Autowired
    private OaDeptService oaDeptService;

    @Autowired
    private OaUserService oaUserService;

    @Autowired
    private AocScheduleService aocScheduleService;

    /**
     * 航班运行监控数据更新
     */
    @InnerAuth
    @GetMapping(value = "/monitor/data/update")
    public void monitorDataUpdate(){
        monitoringService.monitorDataUpdate();
    }

    /**
     * 时隙交换航班信息同步
     */
    @InnerAuth
    @GetMapping(value = "/time/slot/exchange")
    public void timeslotExchange(){
        flightTimeExchangeService.timeslotExchange();
    }

    /**
     * 预测起飞数据更新
     */
    @InnerAuth
    @GetMapping(value = "/ptd/data/update")
    public void ptdDataUpdate(){
        flightOperationMonitoringPtdService.ptdDataUpdate();
    }

    /**
     * 告警规则触发逻辑
     */
    @InnerAuth
    @GetMapping(value = "/alarm/trigger")
    public void alarmTrigger(){
        alarmConfigService.alarmTriggerTask();
    }

    /**
     * 告警规则触发逻辑
     */
    @InnerAuth
    @GetMapping(value = "/oa/data/update")
    public void oaDeptUserDataUpdate(){
        oaDeptService.oaDeptDataUpdate();
        oaUserService.oaUserDataUpdate();
    }

    /**
     * AOC排班信息同步
     */
    @InnerAuth
    @GetMapping(value = "/aoc/schedule/update")
    public void aocScheduleUpdate(){
        aocScheduleService.aocScheduleUpdate();
    }
}
